<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/include/header.jsp" %>
<%String contextPath = request.getContextPath();%>

<div id="qnaMain" style="width:980px"> 
	<table style="border: 0" cellpadding="0" cellspacing="0" border="0">
		<%-- 왼쪽 메뉴--%>
			<tr>
				<td style="vertical-align: top;width: 180px;background-color:  #fdb73a;">
					<%@ include file="/common/include/leftmenu.jsp" %>
				</td>
		<%-- 오른쪽 게시판--%>
				<td style="text-align: center;width: 800px">
					<div>
					<%@include file="logo.jsp" %>	
					<div class="boardname">질문&답변게시판</div>
						<html:form action="/qnaboard">				
						<table  style="text-align: left;width: 700px">
							<tr>
								<td style="width: 100px;" >작성자</td>
								<td style="width: 540px;text-align: left;padding-top: 10px; "><bean:write name="qnaForm" property="mid"/></td>
							</tr>								
							
							<logic:notEmpty name="qnaForm" property="qbdate">
							<tr>
								<td style="width: 100px;" >작성일</td>
								<td style="width: 540px;text-align: left;"><bean:write name="qnaForm" property="qbdate"/></td>
							</tr>
							</logic:notEmpty>

							<logic:notEmpty name="qnaForm" property="qbcounter">
							<tr>
								<td style="width: 100px;" >조회수</td>
								<td style="width: 540px;text-align: left;"><bean:write name="qnaForm" property="qbcounter"/></td>
							</tr>
							</logic:notEmpty>
							
							<tr>
								<td style="width: 100px;" >제목</td>
								<td style="width: 540px;text-align: left;"><html:text property="qbtitle" size="70"/></td>
							</tr>
							
							<tr>
								<td colspan="2" style="height: 500px">
									<html:textarea property="qbcontent" rows="10" cols="80" style="height: 500px"/>
								</td>
							</tr>			
							
							<tr>
								<td colspan="2"  style="text-align: center;"> 
									<a href="javascript:validate();"><img src="<%=imagePath %>icon_confirm.jpg"/></a>
									<a href="javascript:goList();"><img src="<%=imagePath %>icon_list.jpg"/></a>
								</td>
							</tr>
						</table>							
						<input type="hidden" name="method" value="insert"/>
						<input type="hidden" name ="qbno" value = "<bean:write name="qnaForm" property="qbno"/>"/>
						<input type="hidden" name ="qbrefno" value = "<bean:write name="qnaForm" property="qbno"/>"/>
						<input type="hidden" name ="mid" value = "<bean:write name="qnaForm" property="mid"/>"/>
						<input type="hidden" name ="qbtitle" value = "<bean:write name="qnaForm" property="qbtitle"/>"/>
						<input type="hidden" name ="qbcontent" value = "<bean:write name="qnaForm" property="qbcontent"/>"/>			
						</html:form>
					</div>			
<script type="text/javascript" src="<%=path%>/fckeditor/fckeditor.js"> </script>
<script type="text/javascript">
// fck 태그부분 처리

	window.attachEvent("onload", getfckeditor);
	 function getfckeditor(){
		var oFCKeditor = new FCKeditor( 'qbcontent' ) ;
		oFCKeditor.BasePath	= "<%=contextPath%>/fckeditor/" ;
		oFCKeditor.ReplaceTextarea() ;
	}

//제목 유효성 검사	

	function validate(){
		var title = qnaMain.getElementsByTagName('input')[0].value;
		var check = title.replace(/\s/g,"");
		if(check==""){			
			alert("제목은 반드시 입력해 주세요");

	}
		
		document.getElementById('qnaForm').submit();
		
	}
	function goList(){
		document.location  = "<%=contextPath%>/board/qnaboard.do?method=list";
	}

</script>					
				
			</td>
		</tr>
	</table>
</div>					


<%@ include file="../common/include/footer.jsp"%>


